﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
    namespace="SmartHRMS.Model"
        assembly="SmartHRMS.Model">

  <class name="SmartHRMS.Model.Account.Role,SmartHRMS.Model" table="Accounts_Roles" lazy="false">

    <id name="RoleId" column="RoleId" type="guid">
      <generator class="guid" />
    </id>
    
    <property name="Name" >
      <column name="Name"
                    not-null="true" sql-type="nvarchar(250)" length="250" />
    </property>

    <component name="CommonFields" class="CommonFields,SmartHRMS.Model">

      <property name="InsertedBy">
        <column not-null="false" name="InsertedBy" sql-type="uniqueidentifier"/>
      </property>

      <property name="InsertedDate" >
        <column not-null="false" name="InsertedDate" length="50" sql-type="nvarchar(50)"/>
      </property>

      <property name="UpdatedBy">
        <column not-null="false" name="UpdatedBy"  sql-type="uniqueidentifier"/>
      </property>

      <property name="UpdatedDate">
        <column not-null="false" name="UpdatedDate" length="50"  sql-type="nvarchar(50)" />

      </property>
    </component>
    
    <set name="Permission" 
         table="Accounts_RolePermissions"
         cascade="none" inverse="false" generic="true">
      <key column="RoleId"/>      
      <many-to-many class="SmartHRMS.Model.Account.Permission,SmartHRMS.Model" 
                    column="PermissionId" />
    </set>

  </class>

</hibernate-mapping>